*******************************************************************************
* Specify city and years; load data
*******************************************************************************

local city = "fort_worth"

local y1 2009
local y2 2014
local y3 2020

use dataset_`city'_panel, clear

******************************************************************************
* Change in support and share black
******************************************************************************

foreach year in `y2' `y3' {
	
	#delimit;

	gr tw
		(sc dpctyes pctnhblack [aw=totalvotes] if year ==`year',
			msym(Oh) msize(tiny))
		(lpoly dpctyes pctnhblack [aw=totalvotes] if year ==`year',
			col(black) lwid(thick))
		,
			name(g`year', replace)
			plotregion(style(none))
			ylab(, angle(horiz) format(%9.0g))
			yscale(titlegap(*-7))
			legend(off)
			yline(0, lpat(dash))
			title(`year')
			scale(1.3)
			;
	
	#delimit cr
	
	gr close
	
}

gr combine g`y2' g`y3', ycommon xcommon ///
	l1title("Change in Share Yes") b1title("Share Black") ///
	rows(1) xsize(2) ysize(1) 

gr export "_output/figure A8 a.pdf", replace

*******************************************************************************
* Change and support and distance to shooting
*******************************************************************************

foreach year in `y2' `y3'{
	
	#delimit;

	gr tw
		(sc dpctyes distance [aw=totalvotes] if year == `year',
			msym(Oh) msize(tiny))
		(lpoly dpctyes distance [aw=totalvotes] if year == `year',
			col(black) lwid(thick))
		,
			name(g`year', replace)
			plotregion(style(none))
			ylab(, angle(horiz) format(%9.0g))
			yscale(titlegap(*-7))
			legend(off)
			yline(0, lpat(dash))
			title(`year')
			scale(1.3)
			xscale(reverse)
			;
	
	#delimit cr
	
	gr close
	
}

gr combine g`y2' g2020, ycommon xcommon ///
	l1title("Change in Share Yes") b1title("Distance to Shooting (Miles)") ///
	rows(1) xsize(2) ysize(1)
	
gr export "_output/figure A8 b.pdf", replace
	
*******************************************************************************
* End
*******************************************************************************
